package umn.monopolybankservice

class Player {

    String name
    double wallet
    Game game
    boolean isGameCreator = false

    static belongsTo = [game: Game]

    static constraints = {
        name blank: false
        wallet validator: {return it>=0;}
    }

    def getJsonString = {
        return '{"id":"'+ this.id +'","name":"' + this.name + '", "wallet":"' + wallet + '","game":"' + game.name + '", "isGameCreator":"' + this.isGameCreator + '"}'
    }
}
